package com.roger.uia.helper;

import android.graphics.Point;
import com.roger.uia.helper.util.StrUtils;
import java.io.IOException;
import static com.roger.uia.helper.UiBase.mDevice;

public class UiCom {
    private static final String TAG = "Test" + UiCom.class.getSimpleName();

    public static void clearAllApps(){
        try{
            mDevice.pressRecentApps();
            UiBase.waitClickIfObjExist(UiBase.objSelect[2],StrUtils.clearAll,3);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }

    public static void setScreenOn(){
        try{
            mDevice.executeShellCommand("settings put system screen_off_timeout 1800000");
            mDevice.executeShellCommand("settings put global stay_on_while_plugged_in 3");
        }catch (IOException e){
            e.printStackTrace();
        }
    }

    public static void swipeToUnlock(){
        Point p1 = new Point();
        Point p2 = new Point();
        Point p3 = new Point();
        Point p4 = new Point();
        Point p5 = new Point();
        p1.x = 260;p1.y = 970;
        p2.x = 540;p2.y = 970;
        p3.x = 800;p3.y = 970;
        p4.x = 800;p4.y = 1270;
        p5.x = 800;p5.y = 1530;
        Point[] p = {p1, p2, p3, p4, p5};
        mDevice.swipe(p,40);
    }

}
